/*
map的三种定义方式
https://www.bilibili.com/video/BV1gf4y1r79E/?p=15&spm_id_from=pageDriver&vd_source=8bd7b24b38e3e12c558d839b352b32f4
*/
package main

import "fmt"

func main() {
	fmt.Println("map")
	// 1. 声明
	var myMap1 map[string]string
	if myMap1 == nil {
		fmt.Println("myMap1是一个空map")
	}

	// 开辟空间
	myMap1 = make(map[string]string, 10)
	myMap1["one"] = "java"
	myMap1["tow"] = "c++"
	myMap1["three"] = "python"
	fmt.Println(myMap1)

	// 2. 方式二
	myMap2 := make(map[int]string)
	myMap2[1] = "foo"
	myMap2[2] = "bar"
	fmt.Println(myMap2)

	// 3. 方式三
	myMap3 := map[string]string{
		"one":   "java",
		"tow":   "c++",
		"three": "python", // 这个，竟然要加上！
	}
	fmt.Println(myMap3)
}
